package com.kuaigou.cim.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.appleframework.config.core.PropertyConfigurer;
import com.appleframework.distributed.id.IdWorker2;
import com.appleframework.jms.rocketmq.producer.RocketMessageProducer2;
import com.kuaigou.cim.service.TruckerNewPositionSendService;
import com.kuaigou.common.model.bean.Position;

@Service("truckerNewPositionSendService")
public class TruckerNewPositionSendServiceImpl implements TruckerNewPositionSendService {

	private static String KEY_TOPIC = "producer.position.topic";
	
	//private static String KEY_TAGS = "producer.position.tags";
	
	@Resource
	private RocketMessageProducer2 messageProducer;
	
	@Resource
	private IdWorker2 idWorker;
	
	@Override
	public void send(Position position) {
		String topic = PropertyConfigurer.getString(KEY_TOPIC);
		String tags = position.getAccountId().toString();			
		messageProducer.sendObject(topic, tags, idWorker.nextId() + "", position);
	}

}
